home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- """Manages the settings for Orca. This will defer to user settings first, but
- fallback to local settings if the user settings doesn't exist (e.g., in the
- case of gdm) or doesn't have the specified attribute."""
- __id__ = '$Id: settings.py 4674 2009-04-10 13:39:24Z wwalker $'
- __version__ = '$Revision: 4674 $'
- __date__ = '$Date: 2009-04-10 09:39:24 -0400 (Fri, 10 Apr 2009) $'
- __copyright__ = 'Copyright (c) 2004-2008 Sun Microsystems Inc.'
- __license__ = 'LGPL'
- import os
- import re
- screenWidth = 640
- screenHeight = 480
- tty = 7
- canPresentToolTips = False
-
- try:
- import gtk.gdk as gtk
- _display = gtk.gdk.display_get_default()
- _screen = _display.get_default_screen()
- _root_window = _screen.get_root_window()
- screenWidth = _screen.get_width()
- screenHeight = _screen.get_height()
- (atom, format, data) = _root_window.property_get('XFree86_VT')
- tty = data[0]
- minimum_gtk_version = 200000 + 10000 + 11
- current_gtk_version = 100000 * gtk.gtk_version[0] + 1000 * gtk.gtk_version[1] + gtk.gtk_version[2]
- canPresentToolTips = current_gtk_version >= minimum_gtk_version
- except:
- pass
-
-
- try:
- import gconf
- gconfClient = gconf.client_get_default()
- except:
- gconfClient = None
-
- import pyatspi
- import debug
- from acss import ACSS
- from orca_i18n import _
- from orca_i18n import C_
- userCustomizableSettings = [
- 'orcaModifierKeys',
- 'enableSpeech',
- 'speechServerFactory',
- 'speechServerInfo',
- 'voices',
- 'speechVerbosityLevel',
- 'readTableCellRow',
- 'enableSpeechIndentation',
- 'enableEchoByWord',
- 'enableEchoBySentence',
- 'enableKeyEcho',
- 'enablePrintableKeys',
- 'enableModifierKeys',
- 'enableLockingKeys',
- 'enableFunctionKeys',
- 'enableActionKeys',
- 'enableNavigationKeys',
- 'enableTutorialMessages',
- 'enableMnemonicSpeaking',
- 'enableBraille',
- 'enableBrailleContext',
- 'enableBrailleGrouping',
- 'disableBrailleEOL',
- 'brailleEOLIndicator',
- 'brailleVerbosityLevel',
- 'brailleRolenameStyle',
- 'brailleSelectorIndicator',
- 'brailleLinkIndicator',
- 'enableBrailleMonitor',
- 'enableMagnifier',
- 'enableMagLiveUpdating',
- 'enableMagCursor',
- 'enableMagCursorExplicitSize',
- 'magHideCursor',
- 'magCursorSize',
- 'magCursorColor',
- 'enableMagCrossHair',
- 'enableMagCrossHairClip',
- 'magCrossHairSize',
- 'magCrossHairColor',
- 'magZoomerType',
- 'magZoomerLeft',
- 'magZoomerRight',
- 'magZoomerTop',
- 'magZoomerBottom',
- 'magZoomFactor',
- 'enableMagZoomerBorder',
- 'magZoomerBorderSize',
- 'magZoomerBorderColor',
- 'enableMagZoomerColorInversion',
- 'magBrightnessLevel',
- 'magBrightnessLevelRed',
- 'magBrightnessLevelBlue',
- 'magBrightnessLevelGreen',
- 'magContrastLevel',
- 'magContrastLevelRed',
- 'magContrastLevelGreen',
- 'magContrastLevelBlue',
- 'magSmoothingMode',
- 'magMouseTrackingMode',
- 'magControlTrackingMode',
- 'magTextTrackingMode',
- 'magEdgeMargin',
- 'magPointerFollowsFocus',
- 'magPointerFollowsZoomer',
- 'magColorFilteringMode',
- 'magSourceDisplay',
- 'magTargetDisplay',
- 'verbalizePunctuationStyle',
- 'showMainWindow',
- 'quitOrcaNoConfirmation',
- 'presentToolTips',
- 'sayAllStyle',
- 'keyboardLayout',
- 'speakBlankLines',
- 'speakMultiCaseStringsAsWords',
- 'enabledSpokenTextAttributes',
- 'enabledBrailledTextAttributes',
- 'textAttributesBrailleIndicator',
- 'enableProgressBarUpdates',
- 'progressBarUpdateInterval',
- 'enableContractedBraille',
- 'brailleContractionTable',
- 'enableMouseReview',
- 'mouseDwellDelay',
- 'speakCellCoordinates',
- 'speakCellSpan',
- 'speakCellHeaders',
- 'skipBlankCells',
- 'largeObjectTextLength',
- 'wrappedStructuralNavigation',
- 'presentRequiredState',
- 'brailleRequiredStateString',
- 'speechRequiredStateString']
- mainWindowModule = 'orca_gui_main'
- guiPreferencesModule = 'orca_gui_prefs'
- consolePreferencesModule = 'orca_console_prefs'
- appGuiPreferencesModule = 'app_gui_prefs'
- quitModule = 'orca_quit'
- findModule = 'orca_gui_find'
- DESKTOP_MODIFIER_KEYS = [
- 'Insert',
- 'KP_Insert']
- LAPTOP_MODIFIER_KEYS = [
- 'Caps_Lock']
- orcaModifierKeys = DESKTOP_MODIFIER_KEYS
- MODIFIER_ORCA = 8
- VERBOSITY_LEVEL_BRIEF = 0
- VERBOSITY_LEVEL_VERBOSE = 1
- speechVerbosityLevel = VERBOSITY_LEVEL_VERBOSE
- brailleVerbosityLevel = VERBOSITY_LEVEL_VERBOSE
- BRAILLE_ROLENAME_STYLE_SHORT = 0
- BRAILLE_ROLENAME_STYLE_LONG = 1
- brailleRolenameStyle = BRAILLE_ROLENAME_STYLE_LONG
- BRAILLE_SEL_NONE = 0
- BRAILLE_SEL_7 = 64
- BRAILLE_SEL_8 = 128
- BRAILLE_SEL_BOTH = 192
- brailleSelectorIndicator = BRAILLE_SEL_BOTH
- BRAILLE_LINK_NONE = 0
- BRAILLE_LINK_7 = 64
- BRAILLE_LINK_8 = 128
- BRAILLE_LINK_BOTH = 192
- brailleLinkIndicator = BRAILLE_LINK_BOTH
- PUNCTUATION_STYLE_NONE = 3
- PUNCTUATION_STYLE_SOME = 2
- PUNCTUATION_STYLE_MOST = 1
- PUNCTUATION_STYLE_ALL = 0
- verbalizePunctuationStyle = PUNCTUATION_STYLE_MOST
- SAYALL_STYLE_LINE = 0
- SAYALL_STYLE_SENTENCE = 1
- sayAllStyle = SAYALL_STYLE_SENTENCE
- speechRateDelta = 5
- speechPitchDelta = 0.5
- httpServerPort = 0
- maxHttpServerRetries = 20
- if os.getenv('DBUS_SESSION_BUS_ADDRESS'):
- useDBus = True
- else:
- useDBus = False
- enableRemoteLogging = False
- enableSpeech = True
- enableSpeechCallbacks = True
- silenceSpeech = False
- speechFactoryModules = [
- 'espeechfactory',
- 'gnomespeechfactory',
- 'speechdispatcherfactory']
- speechServerFactory = 'gnomespeechfactory'
- speechServerInfo = None
- DEFAULT_VOICE = 'default'
- UPPERCASE_VOICE = 'uppercase'
- HYPERLINK_VOICE = 'hyperlink'
- voices = {
- DEFAULT_VOICE: ACSS({ }),
- UPPERCASE_VOICE: ACSS({
- ACSS.AVERAGE_PITCH: 5.6 }),
- HYPERLINK_VOICE: ACSS({ }) }
- enableSpeechIndentation = False
- enableBraille = True
- enableBrailleContext = True
- enableBrailleGrouping = False
- enableBrailleMonitor = False
- disableBrailleEOL = False
- brailleEOLIndicator = ' $l'
- brailleCheckBoxIndicators = [
- '< >',
- '<x>',
- '<->']
- brailleRadioButtonIndicators = [
- '& y',
- '&=y']
- enableMagnifier = False
- enableMagLiveUpdating = True
- enableMagCursor = True
- enableMagCursorExplicitSize = False
- magHideCursor = False
- magCursorSize = 32
- magCursorColor = '#000000'
- enableMagCrossHair = True
- enableMagCrossHairClip = False
- magCrossHairSize = 16
- magCrossHairColor = '#000000'
- MAG_ZOOMER_TYPE_FULL_SCREEN = 0
- MAG_ZOOMER_TYPE_TOP_HALF = 1
- MAG_ZOOMER_TYPE_BOTTOM_HALF = 2
- MAG_ZOOMER_TYPE_LEFT_HALF = 3
- MAG_ZOOMER_TYPE_RIGHT_HALF = 4
- MAG_ZOOMER_TYPE_CUSTOM = 5
- magZoomerType = MAG_ZOOMER_TYPE_FULL_SCREEN
- magZoomerLeft = screenWidth / 2
- magZoomerRight = screenWidth
- magZoomerTop = 0
- magZoomerBottom = screenHeight
- magZoomFactor = 4
- enableMagZoomerBorder = False
- magZoomerBorderSize = 1
- magZoomerBorderColor = '#000000'
- enableMagZoomerColorInversion = False
- magBrightnessLevel = 0
- magBrightnessLevelRed = 0
- magBrightnessLevelGreen = 0
- magBrightnessLevelBlue = 0
- magContrastLevel = 0
- magContrastLevelRed = 0
- magContrastLevelGreen = 0
- magContrastLevelBlue = 0
- MAG_COLOR_FILTERING_MODE_NONE = 0
- MAG_COLOR_FILTERING_MODE_SATURATE_RED = 1
- MAG_COLOR_FILTERING_MODE_SATURATE_GREEN = 2
- MAG_COLOR_FILTERING_MODE_SATURATE_BLUE = 3
- MAG_COLOR_FILTERING_MODE_DESATURATE_RED = 4
- MAG_COLOR_FILTERING_MODE_DESATURATE_GREEN = 5
- MAG_COLOR_FILTERING_MODE_DESATURATE_BLUE = 6
- MAG_COLOR_FILTERING_MODE_POSITIVE_HUE_SHIFT = 7
- MAG_COLOR_FILTERING_MODE_NEGATIVE_HUE_SHIFT = 8
- magColorFilteringMode = MAG_COLOR_FILTERING_MODE_NONE
- MAG_SMOOTHING_MODE_BILINEAR = 0
- MAG_SMOOTHING_MODE_NONE = 1
- magSmoothingMode = MAG_SMOOTHING_MODE_BILINEAR
- MAG_TRACKING_MODE_CENTERED = 0
- MAG_TRACKING_MODE_PROPORTIONAL = 1
- MAG_TRACKING_MODE_PUSH = 2
- MAG_TRACKING_MODE_NONE = 3
- MAG_MOUSE_TRACKING_MODE_CENTERED = MAG_TRACKING_MODE_CENTERED
- MAG_MOUSE_TRACKING_MODE_PROPORTIONAL = MAG_TRACKING_MODE_PROPORTIONAL
- MAG_MOUSE_TRACKING_MODE_PUSH = MAG_TRACKING_MODE_PUSH
- MAG_MOUSE_TRACKING_MODE_NONE = MAG_TRACKING_MODE_NONE
- magMouseTrackingMode = MAG_TRACKING_MODE_CENTERED
- magControlTrackingMode = MAG_TRACKING_MODE_PUSH
- magTextTrackingMode = MAG_TRACKING_MODE_PUSH
- magEdgeMargin = 0
- magPointerFollowsFocus = False
- magPointerFollowsZoomer = True
- magSourceDisplay = ''
- magTargetDisplay = ''
- enableEchoByWord = False
- enableEchoBySentence = False
- enableKeyEcho = True
- enablePrintableKeys = True
- enableModifierKeys = True
- enableLockingKeys = True
- enableFunctionKeys = True
- enableActionKeys = True
- enableNavigationKeys = False
- enableTutorialMessages = False
- enableMnemonicSpeaking = False
- showMainWindow = True
- quitOrcaNoConfirmation = False
- if False:
- pass
- presentToolTips = canPresentToolTips
- GENERAL_KEYBOARD_LAYOUT_DESKTOP = 1
- GENERAL_KEYBOARD_LAYOUT_LAPTOP = 2
- keyboardLayout = GENERAL_KEYBOARD_LAYOUT_DESKTOP
- outlineColor = [
- 65535,
- 0,
- 0]
- outlineThickness = 4
- outlineMargin = 1
- OUTLINE_NONE = 0
- OUTLINE_BOX = 1
- OUTLINE_LINE = 2
- OUTLINE_WEDGES = 3
- outlineStyle = OUTLINE_BOX
- speakBlankLines = True
- speakMultiCaseStringsAsWords = False
- readTableCellRow = True
- enableProgressBarUpdates = True
- progressBarUpdateInterval = 10
- presentReadOnlyText = True
- speechReadOnlyString = C_('text', 'read only')
- brailleReadOnlyString = C_('text', 'rdonly')
- allTextAttributes = 'bg-color:; bg-full-height:; bg-stipple:; direction:; editable:; family-name:; fg-color:; fg-stipple:; font-effect:none; indent:0; invisible:; justification:left; language:; left-margin:; line-height:100%; paragraph-style:Default; pixels-above-lines:; pixels-below-lines:; pixels-inside-wrap:; right-margin:; rise:; scale:; size:; stretch:; strikethrough:false; style:normal; text-decoration:none; text-rotation:0; text-shadow:none; underline:none; variant:; vertical-align:baseline; weight:400; wrap-mode:; writing-mode:lr-tb;'
- enabledSpokenTextAttributes = 'size:; family-name:; weight:400; indent:0; underline:none; strikethrough:false; justification:left; style:normal; paragraph-style:;'
- enabledBrailledTextAttributes = 'size:; family-name:; weight:400; indent:0; underline:none; strikethrough:false; justification:left; style:normal;'
- TEXT_ATTR_BRAILLE_NONE = 0
- TEXT_ATTR_BRAILLE_7 = 64
- TEXT_ATTR_BRAILLE_8 = 128
- TEXT_ATTR_BRAILLE_BOTH = 192
- textAttributesBrailleIndicator = TEXT_ATTR_BRAILLE_NONE
- repeatCharacterLimit = 4
- ariaLandmarks = [
- 'application',
- 'article',
- 'banner',
- 'complementary',
- 'contentinfo',
- 'definition',
- 'directory',
- 'document',
- 'grid',
- 'log',
- 'main',
- 'menubar',
- 'navigation',
- 'note',
- 'region',
- 'search',
- 'secondary',
- 'seealso',
- 'status']
- enableCustomScripts = True
- keyBindingsMap = { }
- brailleBindingsMap = { }
- cacheValues = True
- cacheDescriptions = True
- cacheAccessibles = True
- learnModeEnabled = False
- userPrefsDir = os.path.join(os.environ['HOME'], '.orca')
- commFailureWaitTime = 0.1
- commFailureAttemptLimit = 5
- gilSleepTime = 1e-05
- useBlockPreventor = False
- useBonoboMain = True
- asyncMode = True
- synchronousToolkits = [
- 'J2SE-access-bridge']
- debugEventQueue = False
- debugMemoryUsage = False
- timeoutTime = 10
- timeoutCallback = None
- doubleClickTimeout = 0.5
-
- def isAccessibilityEnabled():
-
- try:
- return gconfClient.get_bool('/desktop/gnome/interface/accessibility')
- except:
- return False
-
-
-
- def setAccessibilityEnabled(enable):
-
- try:
- return gconfClient.set_bool('/desktop/gnome/interface/accessibility', enable)
- except:
- return False
-
-
-
- def isOrcaAutostarted():
- '''Return an indication of whether Orca autostart at login time is enabled.
- '''
- prefix = '/desktop/gnome/applications/at/visual/'
-
- try:
- if 'orca' in gconfClient.get_string(prefix + 'exec'):
- pass
- return gconfClient.get_bool(prefix + 'startup')
- except:
- return False
-
-
-
- def setOrcaAutostart(enable):
- '''Enable or disable the autostart of Orca at login time.
-
- Arguments:
- - enable: if True, whether Orca autostart at login time is enabled.
-
- Returns an indication of whether the operation was successful.
- '''
- prefix = '/desktop/gnome/applications/at/visual/'
-
- try:
- if gconfClient.set_string(prefix + 'exec', 'orca'):
- pass
- return gconfClient.set_bool(prefix + 'startup', enable)
- except:
- return False
-
-
-
- def isGKSUGrabDisabled():
-
- try:
- return gconfClient.get_bool('/apps/gksu/disable-grab')
- except:
- return False
-
-
-
- def setGKSUGrabDisabled(disable):
-
- try:
- return gconfClient.set_bool('/apps/gksu/disable-grab', disable)
- except:
- return False
-
-
-
- def overrideKeyBindings(script, keyBindings):
- return keyBindings
-
-
- def overridePronunciations(script, pronunciations):
- return pronunciations
-
- settingsPackages = [
- 'app-settings']
- scriptPackages = [
- 'orca-scripts',
- 'scripts',
- 'scripts.apps',
- 'scripts.toolkits']
- _scriptMappings = []
-
- def setScriptMapping(regExpression, moduleName):
- '''Tells this module what script module to look for a given
- application name. The mappings are stored as a list and each
- new mapping is added to the beginning of the list, meaning it
- takes precedence over all other mappings.
-
- Arguments:
- - regExpression: a regular expression used to match against an
- application name
- - moduleName: the name of the Python module containing the script
- class definition for the application
- '''
- _scriptMappings.insert(0, [
- regExpression,
- moduleName])
-
-
- def getScriptModuleName(app):
- '''Returns the module name of the script to use for a given
- application. Any script mapping set via the setScriptMapping
- method is searched first, with the ultimate fallback being the
- name of the application itself.
-
- Arguments:
- - app: the application to find a script module name for
- '''
- if not app.name:
- return None
- for mapping in _scriptMappings:
- regExpression = mapping[0]
- moduleName = mapping[1]
- if regExpression.match(app.name):
- debug.println(debug.LEVEL_FINEST, 'Script mapping for %s is %s' % (app.name, moduleName))
- return moduleName
-
- return app.name
-
- setScriptMapping(re.compile(_('[\\S\\s]*StarOffice[\\s\\S]*')), 'soffice')
- setScriptMapping(re.compile(_('soffice.bin')), 'soffice')
- setScriptMapping(re.compile(_('soffice')), 'soffice')
- setScriptMapping(re.compile(_('[Ee]volution')), 'evolution')
- setScriptMapping(re.compile(_('Deer Park')), 'Mozilla')
- setScriptMapping(re.compile(_('Bon Echo')), 'Mozilla')
- setScriptMapping(re.compile(_('Minefield')), 'Mozilla')
- setScriptMapping(re.compile('Shiretoko'), 'Mozilla')
- setScriptMapping(re.compile('[Ff]irefox'), 'Mozilla')
- setScriptMapping(re.compile(_('Shredder')), 'Thunderbird')
- setScriptMapping(re.compile(_('Mail/News')), 'Thunderbird')
- setScriptMapping(re.compile(_('bug-buddy')), 'gnome_segv2')
- setScriptMapping(re.compile(_('vte')), 'gnome-terminal')
- setScriptMapping(re.compile(_('gaim')), 'pidgin')
- setScriptMapping(re.compile('gnome-help'), 'yelp')
- deprecatedMessages = False
- focusHistoryLength = 5
- listenAllEvents = False
- ignoredEventsList = [
- 'object:bounds-changed']
- inferLiveRegions = True
- enableContractedBraille = False
- brailleContractionTable = ''
- useCollection = True
- speakCellCoordinates = True
- speakCellSpan = True
- speakCellHeaders = True
- skipBlankCells = False
- largeObjectTextLength = 75
- wrappedStructuralNavigation = True
- enableMouseReview = False
- mouseDwellDelay = 0
- mouseDwellMaxDrift = 3
- NO_MODIFIER_MASK = 0
- ALT_MODIFIER_MASK = 1 << pyatspi.MODIFIER_ALT
- CTRL_MODIFIER_MASK = 1 << pyatspi.MODIFIER_CONTROL
- ORCA_MODIFIER_MASK = 1 << MODIFIER_ORCA
- ORCA_ALT_MODIFIER_MASK = 1 << MODIFIER_ORCA | 1 << pyatspi.MODIFIER_ALT
- ORCA_CTRL_MODIFIER_MASK = 1 << MODIFIER_ORCA | 1 << pyatspi.MODIFIER_CONTROL
- ORCA_CTRL_ALT_MODIFIER_MASK = 1 << MODIFIER_ORCA | 1 << pyatspi.MODIFIER_CONTROL | 1 << pyatspi.MODIFIER_ALT
- ORCA_SHIFT_MODIFIER_MASK = 1 << MODIFIER_ORCA | 1 << pyatspi.MODIFIER_SHIFT
- SHIFT_MODIFIER_MASK = 1 << pyatspi.MODIFIER_SHIFT
- SHIFT_ALT_MODIFIER_MASK = 1 << pyatspi.MODIFIER_SHIFT | 1 << pyatspi.MODIFIER_ALT
- COMMAND_MODIFIER_MASK = 1 << pyatspi.MODIFIER_ALT | 1 << pyatspi.MODIFIER_CONTROL | 1 << pyatspi.MODIFIER_META2 | 1 << pyatspi.MODIFIER_META3
- NON_LOCKING_MODIFIER_MASK = 1 << pyatspi.MODIFIER_SHIFT | 1 << pyatspi.MODIFIER_ALT | 1 << pyatspi.MODIFIER_CONTROL | 1 << pyatspi.MODIFIER_META2 | 1 << pyatspi.MODIFIER_META3 | 1 << MODIFIER_ORCA
- ALL_BUT_NUMLOCK_MODIFIER_MASK = 1 << MODIFIER_ORCA | 1 << pyatspi.MODIFIER_SHIFT | 1 << pyatspi.MODIFIER_SHIFTLOCK | 1 << pyatspi.MODIFIER_CONTROL | 1 << pyatspi.MODIFIER_ALT | 1 << pyatspi.MODIFIER_META2 | 1 << pyatspi.MODIFIER_META3
- defaultModifierMask = NON_LOCKING_MODIFIER_MASK
- presentRequiredState = False
- brailleRequiredStateString = _('required')
- speechRequiredStateString = _('required')
-